package com.slmxz.tms.core.exception;

import com.slmxz.tms.common.enums.BizMessageEnum;
import com.slmxz.tms.common.util.I18nUtil;

/**
 * @Author：albert
 * @Date：2025/7/12 21:37
 */
public class Asserts {


    public static void fail(String errorCode) {
        throw new BizException(errorCode);
    }

    public static void fail(String errorCode,String msg) {
        throw new BizException(errorCode,msg);
    }

    public static void fail(BizMessageEnum bizMessageEnum, Object[] messageFormatParams){  //格式化
        throw new BizException(bizMessageEnum,messageFormatParams);
    }

    public static void fail(boolean status,BizMessageEnum bizMessageEnum, Object... messageFormatParams){  //格式化
        if(status){
            throw new BizException(I18nUtil.translate(bizMessageEnum,messageFormatParams));
        }
    }
}
